<%@ page language="java" import="java.util.*" pageEncoding="utf8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>MainPage</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">

    <link rel="stylesheet" type="text/css" href="http://94.191.105.89:8888/jlitetest/css/main.css">

</head>

<body>
<div>
    <h3>status:</h3>
    <p>
        <%
            String unm = (String) request.getAttribute("data");
            if (unm == null) {
                out.write("not login yet!");
            } else {
                out.write("Welcome " + unm + " home.");
            }
        %>
    </p>
</div>
<div>
    <h3>switch identity:</h3>
    <p>
        <a href="/jlitetest/charts/login.yx?unm=Sam&pwd=sam">LoginAsEmployee</a>
    </p>
    <p>
        <a href="/jlitetest/charts/login.yx?unm=Xavi&pwd=xavi">LoginAsManager</a>
    </p>
</div>

<div id="menu">
    department:
    <select id="sltDept">
        <option value="1">first</option>
        <option value="2">second</option>
    </select>
    <br>
    search item:
    <select id="sltItem">
        <option value="1">salary</option>
        <option value="2">profit</option>
    </select>
    <br>
    <button id="btn">OK</button>
</div>
<script>
    document.getElementById("btn").onclick = function () {
        var dept_id = document.getElementById("sltDept").value;
        var item = document.getElementById("sltItem").value;
        if (item == 2) {
            window.location.href = "/jlitetest/charts/profitDept.yx?dept_id=" + dept_id;
        } else if (item == 1) {
            window.location.href = "/jlitetest/charts/salaryDept.yx?dept_id=" + dept_id;
        }
    }
</script>
</body>
</html>